//
//  TTHttpManager.m
//  ExhibitionHall
//
//  Created by 王洋 on 2019/6/3.
//  Copyright © 2019 王洋. All rights reserved.
//

#import "TTHttpManager.h"
#import "Utilities.h"
@implementation TTHttpManager

+(NSMutableDictionary *)cacheBase64ParamWithDic:(NSMutableDictionary *)dic {
    
    NSString *data = [Utilities stringWithDictionary:dic];
    data = [Utilities base64EncodeString:data];
    
    NSMutableDictionary *dataDic = @{}.mutableCopy;
    [dataDic setValue:data forKey:@"data"];
    return dataDic;
}

//标准get请求
+(void)getRequestWithUrl:(NSString *)url TimeOut:(NSInteger)timeOut GetData:(NSDictionary *)getData FinishBlock:(finishBlock)finishBlock FailedBlock:(failedBlock)failedBlock{
    
    TTHttpRequest *request=[[TTHttpRequest alloc]init];
    request.url=url;
    request.timeOut=timeOut;
    request.getData=getData;
    request.finishBlock=finishBlock;
    request.failedBlock=failedBlock;
    [request getStart];
    /**
     if (![Utilities getProxyStatus]) {
         [request getStart];
     } else {
         [SVProgressHUD showErrorWithStatus:@"系统检测当前网络不安全,请连接安全网络"];
         [SVProgressHUD dismissWithDelay:10];
     }
     */
    
}

//标准post请求
+(void)postRequestWithUrl:(NSString *)url TimeOut:(NSInteger)timeOut PostData:(NSDictionary *)postData FinishBlock:(finishBlock)finishBlock FailedBlock:(failedBlock)failedBlock{
    
    TTHttpRequest *request=[[TTHttpRequest alloc]init];
    request.url=url;
    request.timeOut=timeOut;
    request.postData=postData;
    request.finishBlock=finishBlock;
    request.failedBlock=failedBlock;
    [request postStart];
    /**
     if (![Utilities getProxyStatus]) {
         [request postStart];
     } else {
         [SVProgressHUD showErrorWithStatus:@"系统检测当前网络不安全,请连接安全网络"];
         [SVProgressHUD dismissWithDelay:10];
         
     }
     */
    
}

@end
